#include <iostream>
#include <unordered_set>
#include <cstdio>

using namespace std;

int main()
{
	int T;
	cin >> T;
	
	while (T -- )
	{
		int n;
//		cin >> n;
		scanf("%d", &n);
		
		unordered_set<int> set;
		
		for (int i = 0; i < n; i ++ )
		{
			int v;
			scanf("%d", &v) ;
			
			if (set.count(v)) continue;
			
			set.insert(v);
			cout << v << ' ';
		}
		puts("");
	}
	
	return 0;
}